//
//  SZViewController.m
//  项目A_百思不得姐
//
//  Created by wudongyang on 16/5/30.
//  Copyright © 2016年 wudongyang. All rights reserved.
//

#import "SZViewController.h"

@interface SZViewController ()

@end

@implementation SZViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"设置";
    self.SZImageV = [[UIImageView alloc] init];
    self.SZImageV.frame = CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height);
    self.SZImageV.image = [UIImage imageNamed:@"shezhi.jpg"];
    [self.view addSubview:self.SZImageV];
    self.SZImageV.userInteractionEnabled = YES;
    
    self.ExitButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.ExitButton.frame = CGRectMake(57, self.SZImageV.frame.size.height - 124, 300, 50);
    self.ExitButton.backgroundColor = [UIColor redColor];
    self.ExitButton.layer.masksToBounds = YES;
    self.ExitButton.layer.cornerRadius = 5;
    [self.ExitButton setTitle:@"退出当前账号" forState:UIControlStateNormal];
    [self.SZImageV addSubview:self.ExitButton];
    [self.ExitButton addTarget:self action:@selector(ExitButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    
}
-(void)ExitButtonAction:(UIButton *)button{
    DSLog(@"退出当前账号");
    UIAlertController *alert1 = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"确定退出吗" preferredStyle:UIAlertControllerStyleAlert];
    [alert1 addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
    }]];
    [alert1 addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        [defaults setObject:@"0" forKey:@"isLogin"];
        [self.navigationController popViewControllerAnimated:YES];
    }]];
    [self presentViewController:alert1 animated:YES completion:^{
        
        
    }];

}


@end
